import type { AddStaffInfo, selectStaffInfo, StaffUpdate, updateEmpDept, updateEmpPos } from '@/model'
import request from '@/utils/request'

export const getStaff = () => request.get('getStaffList')
export const addStaff = (data: AddStaffInfo) =>
  request.post('/addStaff', JSON.stringify(data), {
    headers: {
      'Content-Type': 'application/json'
    }
  })
export const updateStaff = (data: StaffUpdate) =>
  request.post('/updateStaff', JSON.stringify(data), {
    headers: {
      'Content-Type': 'application/json'
    }
  })
export const selectStaff = (form: selectStaffInfo) =>
  request.post('/selectStaff', JSON.stringify(form), {
    headers: {
      'Content-Type': 'application/json'
    }
  })

export const getAuthorityById = (id: number) => request.get(`/getAuthorityById/${id}`)
export const getAuthority = () => request.get('/getAuthority')
export const getCheckType = () => request.get('/getCheckType')
export const updateEmpStatus = (empId:number,empStatus:string) => request.get(`/updateEmpStatus/${empId}/${empStatus}`)
export const updateEmpDeptId = (form: updateEmpDept) =>
  request.post('/updateEmpDeptId', JSON.stringify(form), {
    headers: {
      'Content-Type': 'application/json'
    }
  })
  export const updateEmpPosId = (form: updateEmpPos) =>
    request.post('/updateEmpPosId', JSON.stringify(form), {
      headers: {
        'Content-Type': 'application/json'
      }
    })
